<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>分销收益明细</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<meta name="decorator" content="ani"/>
	<%@ include file="/webpage/include/bootstraptable.jsp"%>
</head>
<body>
<div class="wrapper wrapper-content">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-primary">
				<div class="panel-heading">
					<h3 class="panel-title">
						<a class="panelButton" href="${ctx}/web/wxAgents"><i class="ti-angle-left"></i> 返回</a>
					</h3>
				</div>
				<div class="panel-body">
					<!-- 表格 -->
					<table id="wxAgentsRecordingTable"   data-toolbar="#toolbar"></table>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
	$(document).ready(function(){
		$('#wxAgentsRecordingTable').bootstrapTable({

			//请求方法
			method: 'get',
			//类型json
			dataType: "json",
			//显示刷新按钮
			showRefresh: true,
			//显示切换手机试图按钮
			showToggle: true,
			//显示 内容列下拉框
			showColumns: true,
			//显示到处按钮
			showExport: true,
			//显示切换分页按钮
			showPaginationSwitch: true,
			//最低显示2行
			minimumCountColumns: 2,
			//是否显示行间隔色
			striped: true,
			//是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
			cache: false,
			//是否显示分页（*）
			pagination: true,
			//排序方式
			sortOrder: "asc",
			//初始化加载第一页，默认第一页
			pageNumber:1,
			//每页的记录行数（*）
			pageSize: 10,
			//可供选择的每页的行数（*）
			pageList: [10, 25, 50, 100],
			//这个接口需要处理bootstrap table传递的固定参数,并返回特定格式的json数据
			url: "${ctx}/web/wxAgents/${agentId}/getRecordDetails",
			//默认值为 'limit',传给服务端的参数为：limit, offset, search, sort, order Else
			//queryParamsType:'',
			////查询参数,每次调用是会带上这个参数，可自定义
			queryParams : function(params) {
				var searchParam = $("#searchForm").serializeJSON();
				searchParam.pageNo = params.limit === undefined? "1" :params.offset/params.limit+1;
				searchParam.pageSize = params.limit === undefined? -1 : params.limit;
				searchParam.orderBy = params.sort === undefined? "" : params.sort+ " "+  params.order;
				return searchParam;
			},
			//分页方式：client客户端分页，server服务端分页（*）
			sidePagination: "server",
			contextMenuTrigger:"right",//pc端 按右键弹出菜单
			contextMenuTriggerMobile:"press",//手机端 弹出菜单，click：单击， press：长按。
			contextMenu: '#context-menu',
			onContextMenuItem: function(row, $el){
				if($el.data("item") == "edit"){
					window.location = "${ctx}/web/wxAgentsRecording/form?id=" + row.id;
				} else if($el.data("item") == "delete"){
					jp.confirm('确认要删除该分销商收入记录记录吗？', function(){
						jp.loading();
						jp.get("${ctx}/web/wxAgentsRecording/delete?id="+row.id, function(data){
							if(data.success){
								$('#wxAgentsRecordingTable').bootstrapTable('refresh');
								jp.success(data.msg);
							}else{
								jp.error(data.msg);
							}
						})

					});

				}
			},

			onClickRow: function(row, $el){
			},
			columns: [
				{
					checkbox: false
				},{
					field: 'agents.id',
					title: '分销商.id',
					sortable: true


				},{
					field: 'agents.userName',
					title: '分销商',
					sortable: true


				}
				,{
					field: 'money',
					title: '收入金额',
					sortable: true

				}
				,{
					field: 'number',
					title: '订单号',
					sortable: true

				}
				,{
					field: 'orderMoney',
					title: '订单金额',
					sortable: true

				}
				,{
					field: 'equipment',
					title: '设备',
					sortable: true

				}
				,{
					field: 'remarks',
					title: '备注信息',
					sortable: true

				}	,{
					field: 'createDate',
					title: '时间',
					sortable: true

				}
			]

		});

		if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端

			$('#wxAgentsRecordingTable').bootstrapTable("toggleView");
		}

	})
</script>
</body>
</html>